home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 61 / Quick PC 61.iso / I386 / SASETUP.MSI / F77537_inc_framework.asp < prev    next >
Encoding:
Text File  |  2003-02-21  |  51.5 KB  |  1,964 lines

  1. <%    '==================================================
  2.     ' Microsoft Server Appliance
  3.     ' Web Framework API Impementation Module
  4.     ' Copyright (c) Microsoft Corporation.  All rights reserved.
  5.     '================================================== %>
  6. <html>
  7. <head>
  8. <meta http-equiv="Content-Type" content="text/html; charset=<%=GetCharSet()%>">
  9. </head>
  10. </html>
  11. <!-- #include file="sh_task.asp" -->
  12. <%
  13. '--------------------------------------------------------------------
  14. ' Event Type Constants
  15. '--------------------------------------------------------------------
  16. Const SA_EVENT_POSTBACK        = 100
  17. Const SA_EVENT_CHANGE         = 101
  18.  
  19. '--------------------------------------------------------------------
  20. ' Private Constants
  21. '--------------------------------------------------------------------
  22. Const PAGE_ELEMENTS        = 5
  23. Const PAGE_SIG            = 0
  24. Const PAGE_TYPE            = 1
  25. Const PAGE_TITLE        = 2
  26. Const PAGE_REFRESH_ENABLED = 3
  27. Const PAGE_REFRESH_INTERVAL = 4
  28.  
  29. Const PAGE_SIG_STRING = "SAGE"
  30.  
  31. '
  32. ' Initialize the tabs array to empty
  33. Redim mstrTabPropSheetTabs(0)
  34.  
  35. '
  36. ' Area and Pagelet page types
  37. Const AREAPAGE = "AREA"
  38. Const PAGELET = "PAGELET"
  39.  
  40. '
  41. ' Programmable Page Attributes
  42. Const PAGEATTR_ENABLE = "ENABLE"
  43. Const PAGEATTR_DISABLE = "DISABLE"
  44.  
  45. ' Automatically emit back button for Area pages
  46. ' Enabled by default. 
  47. ' Disable by Call SA_SetPageAttribute(page, AUTO_BACKBUTTON, PAGEATTR_DISABLE)
  48. Const AUTO_BACKBUTTON = "AutoBackButton"
  49.  
  50.  
  51.  
  52. ' Automatically indent Area page content
  53. ' Enabled by default. 
  54. ' Disable by Call SA_SetPageAttribute(page, AUTO_INDENT, PAGEATTR_DISABLE)
  55. Const AUTO_INDENT = "AutoIndent"
  56.  
  57.  
  58. Dim oPageAttributes
  59.  
  60. '
  61. ' Wizard pages and state control
  62. Dim g_WizardPageID
  63. Dim aWizardPageList()
  64. Redim aWizardPageList(0)
  65.  
  66. Const PA_INTRO         = 0
  67. Const PA_NEXT        = 1
  68. Const PA_BACK        = 2
  69. Const PA_FINISH        = 3
  70.  
  71. Const WIZPAGE_INTRO = 1
  72. Const WIZPAGE_STANDARD = 2
  73. Const WIZPAGE_FINISH = 3
  74.  
  75. '
  76. ' OTS Variable caching and pre-read control. This variable is used to control
  77. ' reentrancy into SA_StoreTableParameters.
  78. Dim g_bSetSelectionVars
  79. g_bSetSelectionVars = FALSE
  80.  
  81. '
  82. ' Set current version of Web Framework
  83. Call SA_SetVersion(2.0)
  84.  
  85.  
  86. '--------------------------------------------------------------------
  87. '
  88. ' Function:    SA_CreatePage
  89. '
  90. ' Synopsis:    Create a new web page of the specified type. This is the first
  91. '            API to call when creating a new page within the SA Kit Web
  92. '            framework.
  93. '
  94. ' Arguments: [in] sPageTitle Localized string for page title
  95. '            [in] sPageImage optional page image url
  96. '            [in] enPageType enumeration type for type of page
  97. '            [out] PageOut output variable to receive Page reference object
  98. '
  99. ' Returns:    SA_NO_ERROR if the page was created successfully.
  100. '            SA_ERROR_INVALIDPAGE if an invalid page type was specified.
  101. '
  102. '--------------------------------------------------------------------
  103. Public Function SA_CreatePage(ByVal sPageTitle, ByVal sPageImage, ByVal enPageType, ByRef PageOut )
  104.     SA_CreatePage = SA_NO_ERROR
  105.     SA_ClearError()
  106.  
  107.     Dim WPage()
  108.     ReDim WPage(PAGE_ELEMENTS)
  109.  
  110.     miPageType = enPageType
  111.     
  112.     mstrTaskTitle = sPageTitle
  113.     If IsArray(sPageTitle) Then
  114.         If ( UBound(sPageTitle) >= 2 ) Then
  115.             gm_sPageTitle = CStr(sPageTitle(0))
  116.             gm_sBannerText = CStr(sPageTitle(1))
  117.         ElseIf (Ubound(sPageTitle) >= 1) Then
  118.             gm_sPageTitle = CStr(sPageTitle(0))
  119.             gm_sBannerText = ""
  120.         Else
  121.             gm_sBannerText = ""
  122.             gm_sPageTitle = ""
  123.         End If
  124.     Else
  125.         gm_sBannerText = sPageTitle
  126.         gm_sPageTitle = sPageTitle
  127.     End If
  128.  
  129.     If IsArray(sPageImage) Then
  130.         If ( UBound(sPageImage) >= 2 ) Then
  131.             mstrPanelPath = sPageImage(1)
  132.             mstrIconPath = sPageImage(0)
  133.         ElseIf ( UBound(sPageImage) >= 1) Then
  134.             mstrIconPath = sPageImage(0)
  135.         End If
  136.     Else
  137.         mstrIconPath = sPageImage
  138.     End If
  139.  
  140.     WPage(PAGE_SIG) = PAGE_SIG_STRING
  141.     WPage(PAGE_TITLE) = sPageTitle
  142.     WPage(PAGE_TYPE    ) = enPageType
  143.     WPage(PAGE_REFRESH_ENABLED) = FALSE
  144.     WPage(PAGE_REFRESH_INTERVAL) = 30
  145.     
  146.     
  147.     Select Case enPageType
  148.         Case PT_PROPERTY
  149.             mstrTaskType = PROPSHEET_TASK
  150.             
  151.         Case PT_WIZARD
  152.             mstrTaskType = WIZARD_TASK
  153.             
  154.         Case PT_TABBED
  155.             mstrTaskType = TAB_PROPSHEET
  156.  
  157.         Case PT_AREA
  158.             mstrTaskType = AREAPAGE
  159.  
  160.         Case PT_PAGELET
  161.             mstrTaskType = PAGELET
  162.  
  163.         Case Else
  164.             Call SA_TraceErrorOut("INC_FRAMEWORK", SAI_GetCaller() + "SA_CreatePage invalid Page Type specified: " + CStr(enPageType))
  165.             SA_CreatePage = SA_SetLastError(SA_ERROR_INVALIDPAGE, "SA_CreatePageEx")
  166.             
  167.     End Select
  168.  
  169.     PageOut = WPage
  170.  
  171.  
  172.     Set oPageAttributes = CreateObject("Scripting.Dictionary")
  173.  
  174.  
  175. End Function
  176.  
  177. '--------------------------------------------------------------------
  178. '
  179. ' Function:    SA_SetPageAttribute
  180. '
  181. ' Synopsis:    Set one of the programmable page attributes
  182. '
  183. ' Arguments: [in] PageIn - Page to add a tab to
  184. '            [in] sAttribute - Attribute to set
  185. '            [in] sValue - Value of attribute
  186. '
  187. ' Returns:    SA_NO_ERROR
  188. '
  189. '--------------------------------------------------------------------
  190. Public Function SA_SetPageAttribute(ByRef PageIn, ByVal sAttribute, ByVal sValue )
  191.     On Error Resume Next
  192.     
  193.     Call oPageAttributes.Add(sAttribute, sValue)
  194.     SA_SetPageAttribute = SA_NO_ERROR
  195.     
  196. End Function
  197.  
  198.  
  199. Private Function SAI_IsAutoBackButtonEnabled()
  200.     On Error Resume Next
  201.     Dim sValue
  202.  
  203.     SAI_IsAutoBackButtonEnabled = TRUE
  204.     
  205.     sValue = oPageAttributes.Item(AUTO_BACKBUTTON)
  206.     If ( Err.Number = 0 ) Then
  207.         If ( UCase(sValue) = PAGEATTR_DISABLE ) Then
  208.             SAI_IsAutoBackButtonEnabled = FALSE
  209.         End If
  210.     End If
  211.     
  212. End Function
  213.  
  214.  
  215. Private Function SAI_IsAutoIndentEnabled()
  216.     On Error Resume Next
  217.     Dim sValue
  218.  
  219.     SAI_IsAutoIndentEnabled = TRUE
  220.     
  221.     sValue = oPageAttributes.Item(AUTO_INDENT)
  222.     If ( Err.Number = 0 ) Then
  223.         If ( UCase(sValue) = PAGEATTR_DISABLE ) Then
  224.             SAI_IsAutoIndentEnabled = FALSE
  225.         End If
  226.     End If
  227.     
  228. End Function
  229.  
  230.  
  231. '--------------------------------------------------------------------
  232. '
  233. ' Function:    SA_AddTabPage
  234. '
  235. ' Synopsis:    Add a tab to a property page
  236. '
  237. ' Arguments: [in] PageIn - Page to add a tab to
  238. '            [in] TabTitle - Title of the new tab 
  239. '            [out] tabId - Ref variable to receive id of this tab
  240. '
  241. ' Returns:    SA_NO_ERROR
  242. '
  243. '--------------------------------------------------------------------
  244. Public Function SA_AddTabPage(ByRef PageIn, ByVal TabTitle, ByRef idTabOut )
  245.     SA_AddTabPage = SA_NO_ERROR
  246.     SA_ClearError()
  247.  
  248.     '
  249.     ' Assert valid page
  250.     '
  251.     If (NOT SAI_IsValidPage(PageIn)) Then
  252.         Call SA_TraceErrorOut("INC_FRAMEWORK", SAI_GetCaller() + "SA_AddTabPage called with invalid page argument.")
  253.                         
  254.         SA_AddTabPage = SA_SetLastError( SA_ERROR_INVALIDPAGE, _
  255.                         "SA_AddTabPage")
  256.         Exit Function
  257.     End If
  258.  
  259.  
  260.     Dim iCurrentTabCt
  261.     If ( NOT IsArray(mstrTabPropSheetTabs) ) Then
  262.         iCurrentTabCt = 0
  263.     Else
  264.         iCurrentTabCt = UBound(mstrTabPropSheetTabs)
  265.     End If
  266.     Redim Preserve mstrTabPropSheetTabs(iCurrentTabCt + 1)
  267.  
  268.     mstrTabPropSheetTabs(iCurrentTabCt)  = TabTitle
  269.  
  270.     'Call SA_TraceOut("INC_FRAMEWORK", "Added tab: " + TabTitle + " UBound(mstrTabPropSheetTabs): " + CStr(UBound(mstrTabPropSheetTabs)))
  271.     
  272.     idTabOut = iCurrentTabCt
  273.  
  274. End Function
  275.  
  276.  
  277. '--------------------------------------------------------------------
  278. '
  279. ' Function:    SA_SetActiveTabPage
  280. '
  281. ' Synopsis:    Sets the active tab in a tabbed property page
  282. '
  283. ' Arguments: [in] PageIn - Page to add a tab to
  284. '            [in] tabId - ID if the tab to make active. This is the same id returned
  285. '                        by SA_AddTabPage.
  286. '
  287. ' Returns:    SA_NO_ERROR
  288. '
  289. '--------------------------------------------------------------------
  290. Public Function SA_SetActiveTabPage(ByRef PageIn, ByVal idTabIn )
  291.     SA_SetActiveTabPage = SA_NO_ERROR
  292.     SA_ClearError()
  293.  
  294.     '
  295.     ' Assert valid page
  296.     '
  297.     If (NOT SAI_IsValidPage(PageIn)) Then
  298.         Call SA_TraceErrorOut("INC_FRAMEWORK", SAI_GetCaller() + "SA_SetActiveTabPage called with invalid page argument.")
  299.                         
  300.         SA_SetActiveTabPage = SA_SetLastError( SA_ERROR_INVALIDPAGE, _
  301.                         "SA_SetActiveTabPage")
  302.         Exit Function
  303.     End If
  304.  
  305.     If ( idTabIn < 0 ) Then
  306.         Call SA_TraceErrorOut("INC_FRAMEWORK", SAI_GetCaller() + "SA_SetActiveTabPage value of idTabIn is invalid, a negative number. ")
  307.         idTabIn = 0
  308.     End If
  309.  
  310.     If ( NOT IsArray(mstrTabPropSheetTabs) ) Then
  311.         Call SA_TraceErrorOut("INC_FRAMEWORK", SAI_GetCaller() + "SA_SetActiveTabPage called before any tabs have been added to the page.")
  312.         idTabIn = 0
  313.     ElseIf ( idTabIn > UBound(mstrTabPropSheetTabs) - 1 ) Then
  314.         Call SA_TraceErrorOut("INC_FRAMEWORK", SAI_GetCaller() + "SA_SetActiveTabPage value of idTabIn is invalid, too large. ")
  315.         idTabIn = UBound(mstrTabPropSheetTabs) - 1
  316.     End If
  317.     
  318.     mintTabSelected = idTabIn
  319.  
  320. End Function
  321.  
  322.  
  323.  
  324.  
  325. '--------------------------------------------------------------------
  326. '
  327. ' Function:    SA_ClearWizardPages
  328. '
  329. ' Synopsis:    Remove all wizard pages from the wizard
  330. '
  331. ' Arguments: None
  332. '
  333. ' Returns:    SA_NO_ERROR
  334. '
  335. '--------------------------------------------------------------------
  336. Function SA_ClearWizardPages(ByRef PageIn)
  337.     SA_ClearError()
  338.     SA_ClearWizardPages = SA_NO_ERROR
  339.     
  340.     ReDim aWizardPageList(0)
  341. End Function
  342.  
  343.  
  344. '--------------------------------------------------------------------
  345. '
  346. ' Function:    SA_AddWizardPage
  347. '
  348. ' Synopsis:    Add a page to the wizard
  349. '
  350. ' Arguments: [in] PageIn - Page to add a tab to
  351. '            [in] PageTitle - Title of the new tab 
  352. '            [out] iPageOut - page number for the new wizard page
  353. '
  354. ' Returns:    SA_ERROR_INVALIDPAGE page is invalid
  355. '            SA_NO_ERROR success
  356. '
  357. '--------------------------------------------------------------------
  358. Function SA_AddWizardPage(ByRef PageIn, ByRef PageTitle, ByRef iPageOut )
  359.     SA_ClearError()
  360.     SA_AddWizardPage = SA_NO_ERROR
  361.     
  362.     '
  363.     ' Assert valid page
  364.     '
  365.     If (NOT SAI_IsValidPage(PageIn)) Then
  366.         Call SA_TraceErrorOut("INC_FRAMEWORK", SAI_GetCaller() + "SA_AddWizardPage invalid page argument.")
  367.         SA_AddWizardPage = SA_SetLastError( SA_ERROR_INVALIDPAGE, "SA_AddWizardPage")
  368.         Exit Function
  369.     End If
  370.  
  371.     
  372.     Dim iPageCt
  373.     ' 
  374.     ' Get current size of wizard page array
  375.     iPageCt = UBound(aWizardPageList)
  376.     
  377.     '
  378.     ' Resize and preserve current entries
  379.     ReDim Preserve aWizardPageList(iPageCt + 1)
  380.  
  381.     '
  382.     ' Add new entry
  383.     aWizardPageList(iPageCt) = PageTitle
  384.  
  385.     '
  386.     ' Set the wizard page id
  387.     iPageOut = iPageCt
  388.     
  389. End Function
  390.  
  391.  
  392. '--------------------------------------------------------------------
  393. '
  394. ' Function:    SA_SetPageRefershInterval
  395. '
  396. ' Synopsis:    Sets the page auto refersh interval
  397. '
  398. ' Arguments: [in] PageIn - Page to change refresh interval for
  399. '            [in] iInterval - Refersh interval in seconds
  400. '
  401. ' Returns:    SA_ERROR_INVALIDPAGE page is invalid
  402. '            SA_NO_ERROR success
  403. '--------------------------------------------------------------------
  404. Public Function SA_SetPageRefreshInterval(ByRef PageIn, ByVal iInterval)
  405.     Call SA_ClearError()
  406.     SA_SetPageRefreshInterval = SA_NO_ERROR
  407.     
  408.     If (NOT SAI_IsValidPage(PageIn)) Then
  409.         Call SA_TraceErrorOut("INC_FRAMEWORK", SAI_GetCaller() + "SA_SetPageRefreshInterval invalid page argument.")
  410.         SA_SetPageRefreshInterval = SA_SetLastError( SA_ERROR_INVALIDPAGE, _
  411.                         "SA_SetPageRefreshInterval")
  412.         Exit Function
  413.     End If
  414.  
  415.     PageIn(PAGE_REFRESH_ENABLED) = TRUE
  416.     PageIn(PAGE_REFRESH_INTERVAL) = CInt(iInterval)
  417.     
  418. End Function
  419.  
  420. Public Function SA_GetPageRefreshInterval(ByRef PageIn, ByRef bEnabled, ByRef iInterval)
  421.     Call SA_ClearError()
  422.     SA_GetPageRefreshInterval = SA_NO_ERROR
  423.     
  424.     If (NOT SAI_IsValidPage(PageIn)) Then
  425.         Call SA_TraceErrorOut("INC_FRAMEWORK", SAI_GetCaller() + "SA_GetPageRefreshInterval invalid page argument.")
  426.         SA_GetPageRefreshInterval = SA_SetLastError( SA_ERROR_INVALIDPAGE, _
  427.                         "SA_GetPageRefreshInterval")
  428.         Exit Function
  429.     End If
  430.  
  431.     bEnabled = PageIn(PAGE_REFRESH_ENABLED)
  432.     iInterval = PageIn(PAGE_REFRESH_INTERVAL)
  433.  
  434. End Function
  435.  
  436. '--------------------------------------------------------------------
  437. '
  438. ' Function:    SA_ShowPage
  439. '
  440. ' Synopsis:    Show the web page.
  441. '
  442. ' Arguments: [in] PageIn Reference to page that is to be shown
  443. '
  444. ' Returns:    SA_ERROR_INVALIDPAGE page is invalid
  445. '            SA_ERROR_INVALIDARG page type is invalid
  446. '            SA_NO_ERROR success
  447. '
  448. '--------------------------------------------------------------------
  449. Public Function SA_ShowPage(ByRef PageIn)
  450.     SA_ShowPage = SA_NO_ERROR
  451.     SA_ClearError()
  452.     
  453.     '
  454.     ' Assert valid page
  455.     '
  456.     If (NOT SAI_IsValidPage(PageIn)) Then
  457.         Call SA_TraceErrorOut("INC_FRAMEWORK", SAI_GetCaller() + "SA_ShowPage called with invalid page argument.")
  458.         SA_ShowPage = SA_SetLastError( SA_ERROR_INVALIDPAGE, _
  459.                         "SA_ShowPage")
  460.     End If
  461.  
  462.     Dim pageType
  463.     pageType = PageIn(PAGE_TYPE)
  464.  
  465.     Dim eventArg
  466.  
  467.     Select Case pageType
  468.         Case PT_PROPERTY
  469.             SA_ShowPage = SAI_ServePropertyPage(pageIn, eventArg)
  470.             
  471.         Case PT_TABBED
  472.             SA_ShowPage = SAI_ServeTabbedPropertyPage(pageIn, eventArg)
  473.             
  474.         Case PT_WIZARD
  475.             SA_ShowPage = SAI_ServeWizardPage(pageIn, eventArg)
  476.             
  477.         Case PT_AREA
  478.             SA_ShowPage = SAI_ServeAreaPage(pageIn, eventArg)
  479.             
  480.         Case PT_PAGELET
  481.             SA_ShowPage = SAI_ServePageletPage(pageIn, eventArg)
  482.             
  483.         Case Else
  484.             Call SA_TraceErrorOut("SA_ShowPage", SAI_GetCaller() + "SA_ShowPage invalid Page Type specified: " + CStr(enPageType))
  485.             SA_ShowPage = SA_SetLastError(SA_ERROR_INVALIDARG, "SA_ShowPage")
  486.     End Select
  487.  
  488. End Function
  489.  
  490.  
  491. '--------------------------------------------------------------------
  492. '
  493. ' Function:    SAI_MakeEvent
  494. '
  495. ' Synopsis:    Create and return an event object. For now it simply returns the 
  496. '            EventType argument. 
  497. '
  498. ' Arguments: [in] PageIn Reference to page
  499. '            [in] EventArgs Reference to EventArgs
  500. '            [in] EventType Type of event 
  501. '
  502. ' Returns:    New Event object
  503. '
  504. '--------------------------------------------------------------------
  505. Private Function SAI_MakeEvent(ByRef Page, ByRef EventArgs, ByVal EventType)
  506.     SAI_MakeEvent = EventType
  507. End Function
  508.  
  509.  
  510. '--------------------------------------------------------------------
  511. '
  512. ' Function:    SA_IsChangeEvent
  513. '
  514. ' Synopsis:    Check to see if the specified EventArg is for a change event.
  515. '
  516. ' Arguments: [in] EventArg Reference to an EventArg
  517. '
  518. ' Returns:    TRUE if it's a change event, otherwise FALSE
  519. '
  520. '--------------------------------------------------------------------
  521. Public Function SA_IsChangeEvent( ByRef EventArg)
  522.     If ( EventArg = SA_EVENT_CHANGE ) Then
  523.         SA_IsChangeEvent = TRUE
  524.     Else
  525.         SA_IsChangeEvent = FALSE
  526.     End If
  527. End Function
  528.  
  529. '--------------------------------------------------------------------
  530. '
  531. ' Function:    SA_IsPostBackEvent
  532. '
  533. ' Synopsis:    Check to see if the specified EventArg is for a 
  534. '            postback event
  535. '
  536. ' Arguments: [in] EventArg Reference to an EventArg
  537. '
  538. ' Returns:    TRUE if it's a postback event, otherwise FALSE
  539. '
  540. '--------------------------------------------------------------------
  541. Public Function SA_IsPostBackEvent( ByRef EventArg)
  542.     If ( EventArg = SA_EVENT_POSTBACK ) Then
  543.         SA_IsPostBackEvent = TRUE
  544.     Else
  545.         SA_IsPostBackEvent = FALSE
  546.     End If
  547. End Function
  548.  
  549.  
  550. '--------------------------------------------------------------------
  551. '
  552. ' Function:    SAI_GetCaller
  553. '
  554. ' Synopsis:    Internal helper function to retrieve the caller ASP script
  555. '            file name for use in a debugging message.
  556. '
  557. ' Arguments: None
  558. '
  559. ' Returns:    String containing caller ASP script source file
  560. '
  561. '--------------------------------------------------------------------
  562. Private Function SAI_GetCaller()
  563.     SAI_GetCaller = " Source: " + SA_GetScriptFileName() + "  Error: "
  564. End Function
  565.  
  566. '--------------------------------------------------------------------
  567. '
  568. ' Function:    SAI_ServePropertyPage
  569. '
  570. ' Synopsis:    Private function to handle state transitions for Property Page
  571. '
  572. ' Arguments: [in] PageIn ref to page object
  573. '            [in] EventArg reference
  574. '
  575. ' Returns:    SA_NO_ERROR
  576. '
  577. '--------------------------------------------------------------------
  578. Private Function SAI_ServePropertyPage(ByRef PageIn, ByRef eventArg)
  579.     SAI_ServePropertyPage = SA_NO_ERROR
  580.         
  581.     If mstrMethod = "CANCEL" Then
  582.         If OnClosePage(PageIn, eventArg) Then
  583.             ServeClose()
  584.         End If
  585.     Else
  586.         Select Case mstrPageName
  587.             Case "Intro"
  588.                 Call OnPostBackPage(PageIn, eventArg)
  589.                  If mstrMethod = "NEXT"  Then
  590.                     If ( OnSubmitPage(PageIn, eventArg) )  Then
  591.                         If OnClosePage(PageIn, eventArg) Then
  592.                             ServeClose()
  593.                         Else
  594.                             mstrMethod = ""
  595.                             Call SAI_BeginPage(PageIn)
  596.                             Call OnServePropertyPage(PageIn, eventArg)
  597.                             Call SAI_EndPage(PageIn)
  598.                         End If
  599.                     Else
  600.                         mstrMethod = ""
  601.                         Call SAI_BeginPage(PageIn)
  602.                         Call OnServePropertyPage(PageIn, eventArg)
  603.                         Call SAI_EndPage(PageIn)
  604.                     End if
  605.                 Else
  606.                     Call SAI_BeginPage(PageIn)
  607.                     Call OnServePropertyPage(PageIn, eventArg)
  608.                     Call SAI_EndPage(PageIn)
  609.                 End If
  610.                 
  611.             Case Else
  612.                 '
  613.                 ' Serve the Page for first time
  614.                 '
  615.                 Call OnInitPage(PageIn, eventArg)
  616.                 Call SAI_BeginPage(PageIn)
  617.                 Call OnServePropertyPage(PageIn, eventArg)
  618.                 Call SAI_EndPage(PageIn)
  619.                 
  620.         End Select
  621.     End If
  622. End Function
  623.  
  624.  
  625. '--------------------------------------------------------------------
  626. '
  627. ' Function:    SAI_ServeTabbedPropertyPage
  628. '
  629. ' Synopsis:    Private function to handle state transistions for Tabbed
  630. '            Property page.
  631. '
  632. ' Arguments: [in] PageIn ref to page object
  633. '            [in] EventArg reference
  634. '
  635. ' Returns:    SA_NO_ERROR
  636. '
  637. '--------------------------------------------------------------------
  638. Private Function SAI_ServeTabbedPropertyPage(ByRef PageIn, ByRef eventArg)
  639.     SAI_ServeTabbedPropertyPage = SA_NO_ERROR
  640.     
  641.     If mstrMethod = "CANCEL" Then
  642.         If OnClosePage(PageIn, eventArg) Then
  643.             ServeClose()
  644.         End If
  645.     Else
  646.         Select Case mstrPageName
  647.             Case "Intro"
  648.                 Call OnPostBackPage(PageIn, eventArg)
  649.                 If mstrMethod = "NEXT"  Then
  650.                     If ( OnSubmitPage(PageIn, eventArg) )  Then
  651.                         If OnClosePage(PageIn, eventArg) Then
  652.                             ServeClose()
  653.                         Else
  654.                             mstrMethod = ""
  655.                             Call SAI_ServeAllPropertyPageTabs(PageIn, eventArg)
  656.                         End If
  657.                     Else
  658.                         mstrMethod = ""
  659.                         Call SAI_ServeAllPropertyPageTabs(PageIn, eventArg)
  660.                     End if
  661.                 Else
  662.                     Call SAI_ServeAllPropertyPageTabs(PageIn, eventArg)
  663.                 End If
  664.                 
  665.             Case Else
  666.                 '
  667.                 ' Serve the Page for first time
  668.                 '
  669.                 Call OnInitPage(PageIn, eventArg)
  670.                 Call SAI_ServeAllPropertyPageTabs(PageIn, eventArg)
  671.                 
  672.         End Select
  673.     End If
  674. End Function
  675.  
  676.  
  677. '--------------------------------------------------------------------
  678. '
  679. ' Function:    SAI_ServeAllPropertyPageTabs
  680. '
  681. ' Synopsis:    Serve all Property page tabs
  682. '
  683. ' Arguments: [in] PageIn reference to page object
  684. '            [in] eventArg reference to event object for this page
  685. '
  686. ' Returns:    SA_NO_ERROR
  687. '
  688. '--------------------------------------------------------------------
  689. Private Function SAI_ServeAllPropertyPageTabs(ByRef PageIn, ByRef EventArg)
  690.     SAI_ServeAllPropertyPageTabs = SA_NO_ERROR
  691.     
  692.     Dim rc
  693.     Dim tabCount
  694.  
  695.     Call SAI_BeginPage(PageIn)
  696.     
  697.     For tabCount = 0 to UBound(mstrTabPropSheetTabs) - 1
  698.         Dim bIsVisible
  699.  
  700.         If ( tabCount = mintTabSelected ) Then
  701.             bIsVisible = TRUE
  702.         Else
  703.             bIsVisible = FALSE
  704.         End If
  705.                 
  706.         Call OnServeTabbedPropertyPage(pageIn, tabCount, bIsVisible, EventArg)
  707.     Next
  708.  
  709.     SAI_ServeAllPropertyPageTabs = TRUE
  710.     
  711.     Call SAI_EndPage(PageIn)
  712. End Function
  713.  
  714.  
  715. '--------------------------------------------------------------------
  716. '
  717. ' Function:    SAI_ServeWizardPage
  718. '
  719. ' Synopsis:    private function to handle state transitions for Wizard
  720. '
  721. ' Arguments: [in] PageIn reference to page object
  722. '            [in] eventArg reference to event object for this page
  723. '
  724. ' Returns:    SA_NO_ERROR
  725. '
  726. '--------------------------------------------------------------------
  727. Private Function SAI_ServeWizardPage(ByRef PageIn, ByRef eventArg)
  728.     Dim iPageCt
  729.     Dim bIsVisible
  730.     Dim idNextPage
  731.     Dim iWizPageType
  732.     
  733.     SAI_ServeWizardPage = SA_NO_ERROR
  734.  
  735.     '
  736.     ' -----------------------------------------------
  737.     ' Handle Cancel
  738.     ' -----------------------------------------------
  739.     '
  740.     If (UCase(mstrMethod) = "CANCEL") Then
  741.         iWizPageType = WIZPAGE_STANDARD
  742.         If (OnClosePage(PageIn, eventArg)) Then
  743.             ServeClose()
  744.             Exit Function
  745.         Else
  746.             mstrMethod = ""
  747.         End If
  748.     End If
  749.     ' Note that we fall through if the close fails
  750.  
  751.  
  752.     '
  753.     ' -----------------------------------------------
  754.     ' Fire postback event
  755.     ' -----------------------------------------------
  756.     '
  757.     If Len(Trim(mstrMethod)) > 0 Then
  758.         Call OnPostBackPage(PageIn, eventArg)
  759.     Else
  760.         Call OnInitPage(PageIn, eventArg)
  761.     End If
  762.     
  763.     '
  764.     ' -----------------------------------------------
  765.     ' Handle Finish (Submit)
  766.     ' -----------------------------------------------
  767.     '
  768.     If (UCase(mstrMethod) = "FINISH") Then
  769.         iWizPageType = WIZPAGE_FINISH
  770.         If ( OnSubmitPage(PageIn, eventArg) ) Then
  771.             If (OnClosePage(PageIn, eventArg)) Then
  772.                 ServeClose()
  773.                 Exit Function
  774.             End If
  775.         End If            
  776.         mstrMethod = "NEXT"
  777.     End If
  778.     ' Note that we fall through if the submit or close fails
  779.  
  780.  
  781.     '
  782.     ' -----------------------------------------------
  783.     ' Determine which Wizard page is next
  784.     ' -----------------------------------------------
  785.     '
  786.     If (UCase(mstrMethod) = "INTRO" OR Len(Trim(mstrMethod)) = 0 ) Then
  787.         iWizPageType = WIZPAGE_INTRO
  788.         g_WizardPageID = 0
  789.     Elseif (UCase(mstrMethod) = "NEXT") Then
  790.         Call SAI_GetWizardPageID(g_WizardPageID)
  791.         Call OnWizardNextPage( pageIn, eventArg, _
  792.                             g_WizardPageID, PA_NEXT, _
  793.                             g_WizardPageID, iWizPageType)
  794.         
  795.     Elseif (UCase(mstrMethod) = "BACK") Then
  796.         Call SAI_GetWizardPageID(g_WizardPageID)
  797.         Call OnWizardNextPage( pageIn, eventArg, _
  798.                             g_WizardPageID, PA_BACK, _
  799.                             g_WizardPageID, iWizPageType)
  800.         
  801.     End If
  802.  
  803.     '
  804.     ' -----------------------------------------------
  805.     ' Output the Wizard, firing OnServeWizard
  806.     ' -----------------------------------------------
  807.     '
  808.     Call SAI_SetWizardPageType(iWizPageType, aWizardPageList(g_WizardPageID))
  809.     Call SAI_BeginPage(PageIn)
  810.     For iPageCt = 0 to ( UBound(aWizardPageList) - 1)
  811.         If ( g_WizardPageID = iPageCt ) Then
  812.             bIsVisible = true
  813.         Else
  814.             bIsVisible = false
  815.         End If
  816.         'SA_TraceOut "INC_FRAMEWORK", _
  817.         '        "OnServeWizardPage #:" + CStr(iPageCt) +_
  818.         '        " Id: " + CStr(aWizardPageList(iPageCt))
  819.         
  820.         Call OnServeWizardPage( pageIn, iPageCt, bIsVisible, eventArg)
  821.     Next
  822.     Call SAI_EndPage(PageIn)
  823.  
  824. End Function
  825.  
  826.  
  827. '--------------------------------------------------------------------
  828. '
  829. ' Function:    SAI_SetWizardPageType
  830. '
  831. ' Synopsis:    Set the wizard page type attributes
  832. '
  833. ' Arguments: [in] iWizPage wizard page type which includes:
  834. '                intro - introduction page
  835. '                standard - standard page
  836. '                finish - finish page
  837. '
  838. ' Returns:    Nothing
  839. '
  840. '--------------------------------------------------------------------
  841. Private Function SAI_SetWizardPageType(ByVal iWizPage, ByVal sWizPageTitle)
  842.     mstrWizPageTitle = sWizPageTitle
  843.  
  844.     Select Case iWizPage
  845.         Case WIZPAGE_INTRO
  846.             mstrWizardPageType = "intro"
  847.             
  848.         Case WIZPAGE_STANDARD
  849.             mstrWizardPageType = "standard"
  850.             
  851.         Case WIZPAGE_FINISH
  852.             mstrWizardPageType = "finish"
  853.  
  854.         Case Else
  855.             Call SA_TraceErrorOut("INC_FRAMEWORK", SAI_GetCaller() + "SAI_SetWizardPageType unknown Wizard page type: (" + CStr(iWizPage) + ")")
  856.             mstrWizardPageType = "standard"
  857.         
  858.     End Select
  859.  
  860. End Function
  861.  
  862.  
  863. '--------------------------------------------------------------------
  864. '
  865. ' Function:    SAI_EmitWizardHeading
  866. '
  867. ' Synopsis:    Emit Wizard control form field(s)
  868. '
  869. ' Arguments: WizPageID id for current wizard page
  870. '
  871. ' Returns:    Nothing
  872. '
  873. '--------------------------------------------------------------------
  874. Private Function SAI_EmitWizardHeading(ByVal WizPageID)
  875.     Response.Write("<INPUT type=hidden ")
  876.     Response.Write(" name=hdnWizardPageID ")
  877.     Response.Write(" value='"+CStr(WizPageID)+"'>" + vbCrLf)
  878. End Function
  879.  
  880.  
  881. '--------------------------------------------------------------------
  882. '
  883. ' Function:    SAI_GetWizardPageID
  884. '
  885. ' Synopsis:    Get the current wizard page id
  886. '
  887. ' Arguments: [out] WizardIDOut reference to receive wizard page id
  888. '
  889. ' Returns:    Current wizard page id
  890. '
  891. '--------------------------------------------------------------------
  892. Private Function SAI_GetWizardPageID(ByRef WizardIDOut)
  893.     Dim wid
  894.     
  895.     wid = CInt(Request.Form("hdnWizardPageID"))
  896.     WizardIDOut = wid
  897.     
  898.     SAI_GetWizardPageID = wid
  899. End Function
  900.  
  901.  
  902. '--------------------------------------------------------------------
  903. '
  904. ' Function:    SAI_ServeAreaPage
  905. '
  906. ' Synopsis:    Private function to handle state transitions for Area page
  907. '
  908. ' Arguments: [in] PageIn reference to page object
  909. '            [in] eventArg reference to event object for this page
  910. '
  911. ' Returns:    SA_NO_ERROR
  912. '
  913. '--------------------------------------------------------------------
  914. Private Function SAI_ServeAreaPage(ByRef PageIn, ByRef eventArg)
  915.     Dim bToolbarEnabled
  916.     Dim bSearchRequest
  917.     Dim bPagingRequest
  918.     Dim sItem
  919.     Dim sValue
  920.     Dim bSortRequest
  921.     Dim iSortCol
  922.     Dim sSortSequence
  923.     Dim sAction
  924.     Dim iPageMin
  925.     Dim iPageMax
  926.     Dim iPageCurrent
  927.     Dim evt
  928.     
  929.     SAI_ServeAreaPage = SA_NO_ERROR
  930.  
  931.     '
  932.     ' Fire the page initialization Event
  933.     '
  934.     Call SA_StoreTableParameters()
  935.     Call OnInitPage(PageIn, eventArg)
  936.  
  937.     bToolbarEnabled = Request.Form(FLD_IsToolbarEnabled)
  938.     If ( bToolbarEnabled = "0" ) Then
  939.  
  940.         '
  941.         ' Toolbar is disabled
  942.     
  943.     Else
  944.         '
  945.         ' Toolbar is enabled
  946.         '
  947.         
  948.  
  949.         '
  950.         ' Check for Sort request
  951.         '
  952.         
  953.         bSortRequest = Int(Request.Form(FLD_SortingRequest))
  954.         If ( bSortRequest > 0 ) Then
  955.             iSortCol = CInt(Request.Form(FLD_SortingColumn))
  956.             sSortSequence = Request.Form(FLD_SortingSequence)
  957.         
  958.             evt = SAI_MakeEvent(PageIn, eventArg, SA_EVENT_CHANGE)
  959.             Call OnSortNotify( PageIn, evt, iSortCol, sSortSequence )
  960.             
  961.         ElseIf ( CInt(SA_GetParam(FLD_SortingEnabled)) > 0 ) Then
  962.  
  963.             iSortCol = SA_GetParam(FLD_SortingColumn)
  964.             If ( Len(iSortCol) > 0 ) Then
  965.                 iSortCol = Int(CStr(iSortCol))
  966.                 sSortSequence = SA_GetParam(FLD_SortingSequence)
  967.         
  968.                 evt = SAI_MakeEvent(PageIn, eventArg, SA_EVENT_POSTBACK)
  969.                 Call OnSortNotify( PageIn, evt, iSortCol, sSortSequence )
  970.             End If
  971.         End If
  972.  
  973.  
  974.         '    
  975.         ' Check for Search request
  976.         
  977.         bSearchRequest = Int(Request.Form(FLD_SearchRequest))
  978.         If ( bSearchRequest > 0 ) Then
  979.             sItem = Request.Form(FLD_SearchItem)
  980.             If ( Len(sItem) > 0 ) Then
  981.                 sItem = CInt(sItem)
  982.             Else
  983.                 sItem = 0
  984.             End If
  985.             
  986.             sValue = Request.Form(FLD_SearchValue)
  987.  
  988.             evt = SAI_MakeEvent(PageIn, eventArg, SA_EVENT_CHANGE)
  989.             Call OnSearchNotify( PageIn, evt, sItem, sValue )
  990.         Else
  991.             sItem = SA_GetParam(FLD_SearchItem)
  992.             If ( Len(sItem) > 0 ) Then
  993.                 sItem = CInt(sItem)
  994.             Else
  995.                 sItem = 0
  996.             End If
  997.             sValue = SA_GetParam(FLD_SearchValue)
  998.  
  999.             If ( Len(sValue) > 0 ) Then
  1000.                 evt = SAI_MakeEvent(PageIn, eventArg, SA_EVENT_POSTBACK)
  1001.                 Call OnSearchNotify( PageIn, evt, sItem, sValue )
  1002.             End If
  1003.         End If
  1004.  
  1005.  
  1006.         '
  1007.         ' Check for Virtual Paging
  1008.         '
  1009.         bPagingRequest = Int(Request.Form(FLD_PagingRequest))
  1010.         If ( bPagingRequest > 0 ) Then
  1011.             sAction = Request.Form(FLD_PagingAction)
  1012.         
  1013.             iPageMin = Request.Form(FLD_PagingPageMin)
  1014.             iPageMax = Request.Form(FLD_PagingPageMax)
  1015.             iPageCurrent = Request.Form(FLD_PagingPageCurrent)
  1016.         
  1017.             evt = SAI_MakeEvent(PageIn, eventArg, SA_EVENT_CHANGE)
  1018.             Call OnPagingNotify( PageIn, evt, sAction, iPageMin, iPageMax, iPageCurrent )
  1019.         else
  1020.             sAction = "notify"
  1021.         
  1022.             iPageMin = SA_GetParam(FLD_PagingPageMin)
  1023.             iPageMax = SA_GetParam(FLD_PagingPageMax)
  1024.             iPageCurrent = SA_GetParam(FLD_PagingPageCurrent)
  1025.  
  1026.             '
  1027.             ' Only fire the OnPagingNotify if it's been enabled. Might need to change the logic
  1028.             ' here to use an 'Enabled' parameter, rather than an empty current page.
  1029.             If ( UCase(SA_GetParam(FLD_PagingEnabled)) = "T"  ) Then
  1030.                 evt = SAI_MakeEvent(PageIn, eventArg, SA_EVENT_POSTBACK)
  1031.                 Call OnPagingNotify( PageIn, evt, sAction, CInt(iPageMin), CInt(iPageMax), CInt(iPageCurrent) )
  1032.             End If
  1033.         
  1034.         End If
  1035.         
  1036.     End If
  1037.  
  1038.     Call SAI_BeginPage(PageIn)
  1039.     Response.Write("<form name='TVData' method='post'>"+vbCrLf)
  1040.     Response.Write("<input type='hidden' name='" & SAI_FLD_PAGEKEY & "' value='" & SAI_GetPageKey() & "'>"+vbCrLf)
  1041.     Call OnServeAreaPage(PageIn, eventArg)
  1042.     Response.Write("</form>"+vbCrLf)
  1043.  
  1044.     If (Len(GetErrMsg()) > 0 ) Then
  1045.         Response.Write("<BR>")
  1046.         Response.Write("<DIV name='divErrMsg' ID='divErrMsg' class='ErrMsg'>")
  1047.         Response.Write("<table class='ErrMsg'><tr><td><img src='" & m_VirtualRoot & "images/critical_error.gif' border=0></td><td>" & GetErrMsg & "</td></tr></table>")
  1048.         Response.Write("</DIV>"+vbCrLf)
  1049.         Response.Write("<BR>")
  1050.         Call SetErrMsg("")
  1051.     End If
  1052.     
  1053.     
  1054.     If ( Len(Request.QueryString("ReturnURL")) > 0 ) Then
  1055.         If ( TRUE = SAI_IsAutoBackButtonEnabled() ) Then
  1056.             Call SA_ServeBackButton(FALSE, Request.QueryString("ReturnURL"))
  1057.         End If
  1058.     End If
  1059.     Call SAI_EmitOTS_SearchSortClientScript()
  1060.     
  1061.     Call SAI_EndPage(PageIn)
  1062.     
  1063. End Function
  1064.  
  1065.  
  1066. '--------------------------------------------------------------------
  1067. '
  1068. ' Function:    SAI_ServePageletPage
  1069. '
  1070. ' Synopsis:    Private function to handle state transitions for Pagelet page
  1071. '
  1072. ' Arguments: [in] PageIn reference to page object
  1073. '            [in] eventArg reference to event object for this page
  1074. '
  1075. ' Returns:    SA_NO_ERROR
  1076. '
  1077. '--------------------------------------------------------------------
  1078. Private Function SAI_ServePageletPage(ByRef PageIn, ByRef eventArg)
  1079.     SAI_ServePageletPage = SA_NO_ERROR
  1080.         
  1081.     '
  1082.     ' Pagelet Pages do not support submit or post-back operations, navigation
  1083.     ' is not supported.
  1084.     '
  1085.     
  1086.     Call SA_StoreTableParameters()
  1087.     Call OnInitPage(PageIn, eventArg)
  1088.     Call SAI_BeginPage(PageIn)
  1089.     Response.Write("<form name='TVData' method='post'>"+vbCrLf)
  1090.     Response.Write("<input type='hidden' name='" & SAI_FLD_PAGEKEY & "' value='" & SAI_GetPageKey() & "'>"+vbCrLf)
  1091.     Call OnServePageletPage(PageIn, eventArg)
  1092.     Response.Write("</form>"+vbCrLf)
  1093.     Call SAI_EndPage(PageIn)
  1094.     
  1095. End Function
  1096.  
  1097.  
  1098. '--------------------------------------------------------------------
  1099. '
  1100. ' Function:    SAI_BeginPage
  1101. '
  1102. ' Synopsis:    Emit page heading content for Web Framework page. Principle
  1103. '            this includes the Branding and Tab Bars.
  1104. '
  1105. ' Arguments: [in] PageIn reference to page object
  1106. '
  1107. ' Returns:    Nothing
  1108. '
  1109. '--------------------------------------------------------------------
  1110. Private Function SAI_BeginPage(ByRef PageIn)
  1111.     Dim pageType
  1112.  
  1113.     '
  1114.     ' Indicate the page has been served for the first time
  1115.     mstrPageName = "Intro"
  1116.     
  1117.     SAI_BeginPage = 0
  1118.  
  1119.     '
  1120.     ' Assert valid page
  1121.     '
  1122.     If (NOT SAI_IsValidPage(PageIn)) Then
  1123.         Call SA_TraceErrorOut("INC_FRAMEWORK", SAI_GetCaller() + "SAI_BeginPage called with invalid page arguement")
  1124.         SAI_BeginPage = SA_ERROR_INVALIDPAGE
  1125.     End If
  1126.  
  1127.     pageType = PageIn(PAGE_TYPE)
  1128.     
  1129.     Select Case pageType
  1130.         Case PT_PROPERTY
  1131.             Call SA_ServeStatusBar()
  1132.             Call ServeTabBar()
  1133.             
  1134.             Call ServeTaskHeader()
  1135.             
  1136.         Case PT_WIZARD
  1137.             Call SA_ServeStatusBar()
  1138.             Call ServeTabBar()
  1139.             
  1140.             Call ServeTaskHeader()
  1141.             Call SAI_EmitWizardHeading(g_WizardPageID)
  1142.             
  1143.         Case PT_TABBED
  1144.             Call SA_ServeStatusBar()
  1145.             Call ServeTabBar()
  1146.             
  1147.             Call ServeTaskHeader()
  1148.  
  1149.         Case PT_AREA
  1150.             Call SA_ServeStatusBar()
  1151.             Call ServeTabBar()
  1152.             Call SAI_EmitAreaPageHeading(PageIn)        
  1153.             
  1154.         Case PT_PAGELET
  1155.             Call SAI_EmitPageletPageHeading(PageIn)        
  1156.             
  1157.         Case Else
  1158.             Call SA_TraceErrorOut("INC_FRAMEWORK", SAI_GetCaller() + "Invalid Page Type: " + CStr(enPageType))
  1159.                             
  1160.             SA_CreatePage = SA_SetLastError(SA_ERROR_INVALIDARG, _
  1161.                             "SAI_BeginPage")
  1162.                             
  1163.             Call ServeTaskHeader()
  1164.     End Select
  1165.     
  1166. End Function
  1167.  
  1168.  
  1169. '--------------------------------------------------------------------
  1170. '
  1171. ' Function:    SAI_EndPage
  1172. '
  1173. ' Synopsis:    Emit page footer page content for a Web Framework page. For
  1174. '            frameset pages this includes the bottom frameset. 
  1175. '
  1176. ' Arguments: [in] PageIn reference to page object
  1177. '
  1178. ' Returns:    Nothing
  1179. '
  1180. '--------------------------------------------------------------------
  1181. Private Function SAI_EndPage(ByRef PageIn)
  1182.     SAI_EndPage = 0
  1183.     SA_ClearError()
  1184.  
  1185.     Select Case PageIn(PAGE_TYPE)
  1186.         Case PT_PROPERTY
  1187.             Call ServeTaskFooter()
  1188.             
  1189.         Case PT_WIZARD
  1190.             Call ServeTaskFooter()
  1191.             
  1192.         Case PT_TABBED
  1193.             Call ServeTaskFooter()
  1194.  
  1195.         Case PT_AREA
  1196.             Call SAI_EmitAreaPageFooter(PageIn)
  1197.             
  1198.         Case PT_PAGELET
  1199.             Call SAI_EmitPageletPageFooter(PageIn)
  1200.             
  1201.         Case Else
  1202.             Call SA_TraceErrorOut("INC_FRAMEWORK", SAI_GetCaller() + "Invalid Page Type: "+CStr(enPageType))
  1203.                             
  1204.             SA_CreatePage = SA_SetLastError(SA_ERROR_INVALIDARG, _
  1205.                             "SAI_EndPage")
  1206.                             
  1207.             Call ServeTaskFooter(PageIn)
  1208.     End Select
  1209.     
  1210. End Function
  1211.  
  1212.  
  1213. '--------------------------------------------------------------------
  1214. '
  1215. ' Function:    SAI_IsValidPage
  1216. '
  1217. ' Synopsis:    Private utility function to validate a Page object
  1218. '
  1219. ' Arguments: [in] PageIn reference to Page object to be validated
  1220. '
  1221. ' Returns:    SA_ERROR_INVALIDPAGE if the page is invalid
  1222. '            SA_NO_ERROR if the page is valid
  1223. '
  1224. '--------------------------------------------------------------------
  1225. Private Function SAI_IsValidPage(ByRef PageIn)
  1226.     SAI_IsValidPage = FALSE
  1227.     
  1228.     If ( IsArray(PageIn) ) Then
  1229.         If ( UBound(PageIn) = PAGE_ELEMENTS ) Then
  1230.             If ( PageIn(PAGE_SIG) = PAGE_SIG_STRING ) Then
  1231.                 SAI_IsValidPage = TRUE
  1232.             Else
  1233.                 SA_TraceErrorOut "INC_FRAMEWORK", SAI_GetCaller() + "SAI_IsValidPage() Invalid page signature"
  1234.             End If
  1235.         Else
  1236.             SA_TraceErrorOut "INC_FRAMEWORK", SAI_GetCaller() + "SAI_IsValidPage() UBound(PageIn) = PAGE_ELEMENTS failed"
  1237.         End If
  1238.     Else
  1239.         SA_TraceErrorOut "INC_FRAMEWORK", SAI_GetCaller() + "SAI_IsValidPage() IsArray(PageIn) failed"
  1240.     End If
  1241.  
  1242.     If ( NOT SAI_IsValidPage ) Then
  1243.         Call SA_SetLastError(SA_ERROR_INVALIDPAGE, "SAI_IsValidPage")
  1244.     End If
  1245.     
  1246. End Function
  1247.  
  1248.  
  1249. '--------------------------------------------------------------------
  1250. '
  1251. ' Function:    SAI_EmitAreaPageHeading
  1252. '
  1253. ' Synopsis:    Private function to emit heading for an Area page.
  1254. '
  1255. ' Arguments: [in] PageIn reference to page object
  1256. '
  1257. ' Returns:    Nothing
  1258. '
  1259. '--------------------------------------------------------------------
  1260. Private Function SAI_EmitAreaPageHeading(ByRef PageIn)
  1261. %>
  1262. <HTML>
  1263. <head>
  1264. <%
  1265.     Dim bRefresh
  1266.     Dim iInterval
  1267.     Call SA_GetPageRefreshInterval(PageIn, bRefresh, iInterval)
  1268.     If ( TRUE = bRefresh ) Then
  1269. %>
  1270. <meta HTTP-EQUIV="Refresh" CONTENT="<%=CStr(iInterval)%>">
  1271. <% 
  1272.     End If 
  1273. %>
  1274. <meta http-equiv="Content-Type" content="text/html; charset=<%=GetCharSet()%>">
  1275. <TITLE><%=SAI_GetPageTitle()%></TITLE>
  1276. <%            
  1277.     Call SA_EmitAdditionalStyleSheetReferences("")
  1278. %>        
  1279. <SCRIPT LANGUAGE="JavaScript" SRC="<%=m_VirtualRoot%>sh_page.js"></SCRIPT>
  1280. <SCRIPT Language="JavaScript">
  1281. function PageInit()
  1282. {
  1283.     var oException;
  1284.     
  1285.     try 
  1286.     {
  1287.         Init();
  1288.     }
  1289.     catch(oException)
  1290.     {
  1291.         if ( SA_IsDebugEnabled() ) 
  1292.         {
  1293.             alert("Unexpected exception while attempting to execute Init() function.\n\n" +
  1294.                 "Error: " + oException.number + "\n" +
  1295.                 "Description: " + oException.description + "\n");
  1296.         }
  1297.     }
  1298.     
  1299.     var oFooter = eval("top.footer");
  1300.     if ( oFooter != null )
  1301.         {
  1302.         if ( SA_IsDebugEnabled() ) 
  1303.         {
  1304.             var msg = "Error: The current page is being opened using a frameset but it does not require one.\n\n";
  1305.             msg += "The current page is either an Area page or a Pagelet. ";
  1306.             msg += "These pages work without frameset. Normally this error indicates that the call to ";
  1307.             msg += "OTS_CreateTask was made using the incorrect PageType parameter. The correct PageType ";
  1308.             msg += "value this page is OTS_PT_AREA.";
  1309.                     
  1310.             alert(msg);
  1311.         }
  1312.         return;
  1313.     }
  1314. }
  1315. </SCRIPT>
  1316. </HEAD>
  1317. <BODY onLoad="PageInit()" 
  1318.         onDragDrop="return false;" 
  1319.         oncontextmenu="//return false;"> 
  1320. <DIV class='PageBodyIndent'>
  1321. <% 
  1322.     Call ServeStandardHeaderBar(SAI_GetBannerText(), mstrIconPath)
  1323.     If ( SAI_IsAutoIndentEnabled() ) Then
  1324. %>
  1325. <DIV class='PageBodyInnerIndent'>
  1326. <%
  1327.     End If
  1328.     
  1329. End Function
  1330. %>
  1331.  
  1332. <%
  1333. '--------------------------------------------------------------------
  1334. '
  1335. ' Function:    SAI_EmitAreaPageFooter
  1336. '
  1337. ' Synopsis:    Private function to emit footer for an Area page.
  1338. '
  1339. ' Arguments: [in] PageIn reference to page object
  1340. '
  1341. ' Returns:    Nothing
  1342. '
  1343. '--------------------------------------------------------------------
  1344. Private Function SAI_EmitAreaPageFooter(ByRef PageIn)
  1345.  
  1346.     If ( SAI_IsAutoIndentEnabled() ) Then
  1347. %>
  1348. </DIV>
  1349. <% End If %>    
  1350. </DIV>
  1351. </BODY>
  1352. </HTML>
  1353. <%
  1354. End Function
  1355.  
  1356.  
  1357. '--------------------------------------------------------------------
  1358. '
  1359. ' Function:    SAI_EmitPageletPageHeading
  1360. '
  1361. ' Synopsis:    Private function to emit heading for an Pagelet page.
  1362. '
  1363. ' Arguments: [in] PageIn reference to page object
  1364. '
  1365. ' Returns:    Nothing
  1366. '
  1367. '--------------------------------------------------------------------
  1368. Private Function SAI_EmitPageletPageHeading(ByRef PageIn)
  1369. %>
  1370. <HTML>
  1371. <head>
  1372. <%
  1373.     Dim bRefresh
  1374.     Dim iInterval
  1375.     Call SA_GetPageRefreshInterval(PageIn, bRefresh, iInterval)
  1376.     If ( TRUE = bRefresh ) Then
  1377. %>
  1378. <meta HTTP-EQUIV="Refresh" CONTENT="<%=CStr(iInterval)%>">
  1379. <% 
  1380.     End If 
  1381. %>
  1382. <meta http-equiv="Content-Type" content="text/html; charset=<%=GetCharSet()%>">
  1383. <TITLE><%=SAI_GetPageTitle()%></TITLE>
  1384. <%            
  1385.     Call SA_EmitAdditionalStyleSheetReferences("")
  1386. %>        
  1387. <SCRIPT LANGUAGE="JavaScript" SRC="<%=m_VirtualRoot%>sh_page.js"></SCRIPT>
  1388. <SCRIPT Language="JavaScript">
  1389. function PageInit()
  1390. {
  1391.     var oException;
  1392.     
  1393.     try 
  1394.     {
  1395.         Init();
  1396.     }
  1397.     catch(oException)
  1398.     {
  1399.         if ( SA_IsDebugEnabled() ) 
  1400.         {
  1401.             alert("Unexpected exception while attempting to execute Init() function.\n\n" +
  1402.                 "Error: " + oException.number + "\n" +
  1403.                 "Description: " + oException.description + "\n");
  1404.         }
  1405.     }
  1406.     
  1407.     var oFooter = eval("top.footer");
  1408.     if ( oFooter != null )
  1409.         {
  1410.         if ( SA_IsDebugEnabled() ) 
  1411.         {
  1412.             var msg = "Error: The current page is being opened using a frameset but it does not require one.\n\n";
  1413.             msg += "The current page is either an Area page or a Pagelet. ";
  1414.             msg += "These pages work without frameset. Normally this error indicates that the call to ";
  1415.             msg += "OTS_CreateTask was made using the incorrect PageType parameter. The correct PageType ";
  1416.             msg += "value this page is OTS_PT_AREA.";
  1417.                     
  1418.             alert(msg);
  1419.         }
  1420.         return;
  1421.     }
  1422.     
  1423. }
  1424. </SCRIPT>
  1425. </HEAD>
  1426. <BODY onLoad="PageInit()" 
  1427.         onDragDrop="return false;" 
  1428.         oncontextmenu="//return false;"> 
  1429. <% 
  1430.     Call ServeStandardHeaderBar(SAI_GetBannerText(), mstrIconPath)
  1431.     
  1432.     If ( (Len(SAI_GetBannerText()) > 0) OR ((Len(mstrIconPath) > 0)) ) Then
  1433.         Response.Write("<div class='PageBodyInnerIndent'>"+vbCrLf)
  1434.     End If
  1435. End Function
  1436.  
  1437.  
  1438.  
  1439. '--------------------------------------------------------------------
  1440. '
  1441. ' Function:    SAI_EmitPageletPageFooter
  1442. '
  1443. ' Synopsis:    Private function to emit footer for an Pagelet page.
  1444. '
  1445. ' Arguments: [in] PageIn reference to page object
  1446. '
  1447. ' Returns:    Nothing
  1448. '
  1449. '--------------------------------------------------------------------
  1450. Private Function SAI_EmitPageletPageFooter(ByRef PageIn)
  1451.     If ( (Len(SAI_GetBannerText()) > 0) OR ((Len(mstrIconPath) > 0)) ) Then
  1452.         Response.Write(vbCrLf+"</div>"+vbCrLf)
  1453.     End If
  1454. %>
  1455. </BODY>
  1456. </HTML>
  1457. <%
  1458. End Function
  1459.  
  1460.  
  1461. '--------------------------------------------------------------------
  1462. '
  1463. ' Function:    SA_StoreTableParameters
  1464. '
  1465. ' Synopsis:    Internal helper function to store the state of the item selections
  1466. '            that may have been made when the current page was called
  1467. '            from an OTS page.
  1468. '
  1469. ' Arguments: None
  1470. '
  1471. ' Returns:    None
  1472. '
  1473. '--------------------------------------------------------------------
  1474. Private Function SA_StoreTableParameters()
  1475.     Dim x
  1476.     Dim sVarName
  1477.     Dim sVarValue
  1478.  
  1479.     
  1480.     If ( TRUE = g_bSetSelectionVars ) Then
  1481.         Exit Function
  1482.     End If
  1483.  
  1484.     g_bSetSelectionVars = TRUE
  1485.     
  1486.     
  1487.     'Call SA_TraceOut("INC_FRAMEWORK", "Entering SA_StoreTableParameters()")
  1488.     Session("TVItem_Checked") = "No"
  1489.     If ( Request.Form("TVItem_Table1").Count > 0 ) Then
  1490.  
  1491.         'Call SA_TraceOut("INC_FRAMEWORK", "Found " + CStr(Request.Form("TVItem_Table1").Count) + " Table parameters")
  1492.  
  1493.         Session("TVItem_Count") = Request.Form("TVItem_Table1").Count
  1494.         
  1495.         For x = 1 to Request.Form("TVItem_Table1").Count
  1496.             sVarName = "Item"+CStr(x)
  1497.             
  1498.             sVarValue = Request.Form("TVItem_Table1")(x)            
  1499.             sVarValue = SA_UnEncodeQuotes(sVarValue)
  1500.             
  1501.             'Call SA_TraceOut("INC_FRAMEWORK", "Variable: " + sVarName + " value:" + sVarValue)
  1502.             Session(sVarName) = sVarValue
  1503.         Next
  1504.     Else
  1505.         'Call SA_TraceOut("INC_FRAMEWORK", "SA_StoreTableParameters found no data")
  1506.         Session("TVItem_Count") = "None"
  1507.     End If
  1508.     
  1509. End Function
  1510.  
  1511.  
  1512. Private Function SAI_CopyTableSelection(ByVal sParamName)
  1513.     Dim iX
  1514.     Dim iCount
  1515.     Dim sValue
  1516.     Dim sVarName
  1517.     Dim sPKeyVarName
  1518.  
  1519.     'Call SA_TraceOut("INC_FRAMEWORK", "Entering SAI_CopyTableSelection")
  1520.     
  1521.     iCount = CInt(Session("TVItem_Count"))
  1522.     Session(sParamName + "_Count") = iCount
  1523.     
  1524.     'Call SA_TraceOut("INC_FRAMEWORK", "Session("+sParamName + "_Count" + ") = " + CStr(Session(sParamName + "_Count")))
  1525.     
  1526.     For iX = 1 to iCount
  1527.         
  1528.         sVarName = "Item"+CStr(iX)
  1529.         sPKeyVarName = sParamName + "_Item_"+ CStr(iX)
  1530.         Session(sPKeyVarName) = Session(sVarName)
  1531.         Session(sVarName) = ""
  1532.         
  1533.         'Call SA_TraceOut("INC_FRAMEWORK", "Session("+sPKeyVarName+") = " + Session(sPKeyVarName))
  1534.         
  1535.     Next
  1536.  
  1537.     Session("TVItem_Checked") = "YES"
  1538.     
  1539. End Function
  1540.  
  1541.  
  1542. '--------------------------------------------------------------------
  1543. '
  1544. ' Function:        OTS_GetTableSelectionCount
  1545. '
  1546. ' Synopsis:        Get the number of OTS table selections. OTS Tasks should
  1547. '                call this API to determine how many objects the user selected.
  1548. '                OTS_GetTableSelection is then repeatedly called to retrieve the
  1549. '                object key for each of the selected items.
  1550. '
  1551. ' Arguments:    [in] sParamName Parameter name for object key
  1552. '
  1553. ' Returns:        Number of table selections that exist
  1554. '
  1555. '--------------------------------------------------------------------
  1556. Public Function OTS_GetTableSelectionCount(ByVal sParamName)
  1557.     Dim sValue
  1558.     Dim iCount
  1559.  
  1560.     OTS_GetTableSelectionCount = 0
  1561.  
  1562.     IF ( Len(sParamName) <= 0 ) Then
  1563.         sParamName = "PKey"
  1564.     End If
  1565.  
  1566.     'Call SA_TraceOut("INC_FRAMEWORK", "Entering OTS_GetTableSelectionCount("+sParamName+")")
  1567.  
  1568.     '
  1569.     ' If no data was posted
  1570.     If ( Session("TVItem_Count") = "None" ) Then
  1571.         Call SA_TraceOut("INC_FRAMEWORK", "OTS_GetTableSelectionCount detected data not posted")
  1572.  
  1573.         '
  1574.         ' Check QueryString
  1575.         sValue = Request.QueryString(sParamName)
  1576.         If ( Len(sValue) > 0 ) Then
  1577.             'Call SA_TraceOut("INC_FRAMEWORK", "OTS_GetTableSelectionCount found parameter in QueryString("+sParamName+"): " + CStr(sValue))
  1578.             iCount = 1
  1579.             Session("TVItem_Count") = iCount
  1580.  
  1581.             Dim sVarName
  1582.             sVarName = "Item"+CStr(iCount)
  1583.             Session(sVarName) = sValue
  1584.             Call SAI_CopyTableSelection(sParamName)        
  1585.             OTS_GetTableSelectionCount = CInt(Session(sParamName + "_Count"))
  1586.             Exit Function
  1587.         End If
  1588.         
  1589.         '
  1590.         ' Check session variables
  1591.         iCount = Session(sParamName + "_Count")
  1592.         If ( Len(iCount) > 0 ) Then
  1593.             If ( CInt(iCount) > 0 ) Then
  1594.                 'Call SA_TraceOut("INC_FRAMEWORK", "OTS_GetTableSelectionCount found parameter in Session("+sParamName + "_Count"+"): " + CStr(iCount))
  1595.                 OTS_GetTableSelectionCount = iCount
  1596.                 Exit Function
  1597.             End If
  1598.         End If
  1599.  
  1600.  
  1601.     '
  1602.     ' Copy posted data to session variables
  1603.     Else
  1604.     
  1605.         Call SA_TraceOut("INC_FRAMEWORK", "OTS_GetTableSelectionCount data posted, count =" + CStr(Session("TVItem_Count")))
  1606.         '
  1607.         ' If data was posted then copy to session variables
  1608.         iCount = Session("TVItem_Count")
  1609.         If ( Len(iCount) > 0 ) Then
  1610.             If ( CInt(iCount) > 0 ) Then
  1611.                 If (Session("TVItem_Checked") <> "YES") Then
  1612.                     Call SAI_CopyTableSelection(sParamName)        
  1613.                 End If
  1614.                 OTS_GetTableSelectionCount = CInt(Session(sParamName + "_Count"))
  1615.                 Exit Function
  1616.             End If
  1617.         End If
  1618.  
  1619.         Call SA_TraceErrorOut("INC_FRAMEWORK", "OTS_GetTableSelectionCount found invalid TVItem_Count: " + CStr(Session("TVItem_Count")))
  1620.         Call SA_TraceErrorOut("INC_FRAMEWORK", "OTS_GetTableSelectionCount caller was: " + CStr(SA_GetScriptFileName()))
  1621.         
  1622.     End If
  1623.  
  1624.  
  1625. End Function
  1626.  
  1627.  
  1628. '--------------------------------------------------------------------
  1629. '
  1630. ' Function:        OTS_GetTableSelection
  1631. '
  1632. ' Synopsis:        Retrieve the object key for a selected object. 
  1633. '
  1634. ' Arguments:     [in]  sParamName Parameter name for object key
  1635. '                [in]  iIndex Index number of the selected item
  1636. '                [out] Output parameter which recieves the value of the object key
  1637. '
  1638. ' Returns:        TRUE if the specified object was found, otherwise FALSE
  1639. '
  1640. '--------------------------------------------------------------------
  1641. Public Function OTS_GetTableSelection(ByVal sParamName, ByVal iIndex, ByRef sValue)
  1642.     Dim iCount
  1643.  
  1644.     IF ( Len(sParamName) <= 0 ) Then
  1645.         sParamName = "PKey"
  1646.     End If
  1647.  
  1648.     'Call SA_TraceOut("INC_FRAMEWORK", "Entering OTS_GetTableSelection("+sParamName+")")
  1649.     
  1650.     If ( Session("TVItem_Checked") <> "YES" ) Then
  1651.         Call OTS_GetTableSelectionCount(sParamName)
  1652.     End If
  1653.     
  1654.     iCount = CInt(Session(sParamName + "_Count"))
  1655.     If ( (iCount <= 0) OR (iIndex > iCount) ) Then
  1656.         OTS_GetTableSelection = FALSE
  1657.     Else
  1658.         Dim sVarName
  1659.         sVarName = sParamName + "_Item_"+ CStr(iIndex)
  1660.     
  1661.         sValue = Session(sVarName)
  1662.  
  1663.         OTS_GetTableSelection = TRUE
  1664.  
  1665.     End If
  1666.     
  1667. End Function
  1668.  
  1669.  
  1670. '--------------------------------------------------------------------
  1671. '
  1672. ' Function:    SAI_EmitOTS_SearchSortClientScript
  1673. '
  1674. ' Synopsis:    Internal helper function to emit client-side javascript in support
  1675. '            of the OTS Widget.
  1676. '
  1677. ' Arguments: None
  1678. '
  1679. ' Returns:    None
  1680. '
  1681. '--------------------------------------------------------------------
  1682. Private Function SAI_EmitOTS_SearchSortClientScript()
  1683. %>
  1684. <html>
  1685. <head>
  1686. <meta http-equiv="Content-Type" content="text/html; charset=<%=GetCharSet()%>">
  1687. <script language="javascript">
  1688. // ==============================================================
  1689. //     Microsoft Server Appiance
  1690. //     OTS Advanced Search, Sort, and Virtual Paging Functions Support
  1691. //    Copyright (c) Microsoft Corporation.  All rights reserved.
  1692. // ==============================================================
  1693.  
  1694. var FLD_PagingEnabled = '<%=FLD_PagingEnabled%>';
  1695. var FLD_PagingPageMin = '<%=FLD_PagingPageMin%>';
  1696. var FLD_PagingPageMax = '<%=FLD_PagingPageMax%>';
  1697. var FLD_PagingPageCurrent = '<%=FLD_PagingPageCurrent%>';
  1698.  
  1699. var FLD_SearchItem = '<%=FLD_SearchItem%>';
  1700. var FLD_SearchValue = '<%=FLD_SearchValue%>';
  1701. var FLD_SearchRequest = '<%=FLD_SearchRequest%>';
  1702.     
  1703. var FLD_SortingColumn = '<%=FLD_SortingColumn%>';
  1704. var FLD_SortingSequence = '<%=FLD_SortingSequence%>';
  1705. var FLD_SortingRequest = '<%=FLD_SortingRequest%>';
  1706. var FLD_SortingEnabled = '<%=FLD_SortingEnabled%>';
  1707.  
  1708. var FLD_IsToolbarEnabled = '<%=FLD_IsToolbarEnabled%>';
  1709.  
  1710. function OTS_SubmitSearch()
  1711. {
  1712.     var objOTSForm;
  1713.     
  1714.  
  1715.     objOTSForm = eval("document.TVData")
  1716.     if ( objOTSForm == null || objOTSForm.length <= 0 )
  1717.     {
  1718.         return;
  1719.     }
  1720.     objOTSForm.<%=FLD_SearchRequest%>.value = '1';
  1721.     
  1722.     objOTSForm.tSelectedItem.value = '' ;
  1723.     objOTSForm.tSelectedItemNumber.value = 0;
  1724.     
  1725.     var pKey = objOTSForm.fldPKeyParamName.value;
  1726.     var sURL = top.location;
  1727.     sURL = SA_MungeURL(sURL, pKey, "");
  1728.     sURL = OTS_MungeDeleteSearchSort(sURL);
  1729.     objOTSForm.action = sURL;
  1730.     objOTSForm.submit();
  1731. }
  1732.  
  1733.  
  1734. function OTS_SubmitPageChange(pageAction)
  1735. {
  1736.     var objOTSForm;
  1737.     
  1738.  
  1739.     objOTSForm = eval("document.TVData")
  1740.     if ( objOTSForm == null || objOTSForm.length <= 0 )
  1741.     {
  1742.         return;
  1743.     }
  1744.     objOTSForm.fldPagingRequest.value = '1';
  1745.     objOTSForm.fldPagingAction.value = pageAction.toLowerCase();
  1746.     
  1747.     var iPageCurrent = parseInt(objOTSForm.<%=FLD_PagingPageCurrent%>.value);
  1748.     if ( isNaN(iPageCurrent) ) iPageCurrent = 0;
  1749.     var iPageMax = parseInt(objOTSForm.<%=FLD_PagingPageMax%>.value);
  1750.     if ( isNaN(iPageMax) ) iPageMax = 0;
  1751.     var iPageMin = parseInt(objOTSForm.<%=FLD_PagingPageMin%>.value);
  1752.     if ( isNaN(iPageMin) ) iPageMin = 1;
  1753.     
  1754.     if (objOTSForm.fldPagingAction.value == "prev" )
  1755.     {
  1756.         if ( SA_IsIE() )
  1757.         {
  1758.             if (window.event.shiftKey)
  1759.             {
  1760.                 iPageCurrent = iPageMin;
  1761.             }
  1762.             else
  1763.             {
  1764.                 iPageCurrent -= 1;
  1765.             }
  1766.         }
  1767.         else
  1768.         {
  1769.             iPageCurrent -= 1;
  1770.         }
  1771.     }
  1772.     else
  1773.     {
  1774.         if ( SA_IsIE() )
  1775.         {
  1776.             if (window.event.shiftKey)
  1777.             {
  1778.                 iPageCurrent = iPageMax;
  1779.             }
  1780.             else
  1781.             {
  1782.                 iPageCurrent += 1;
  1783.             }
  1784.         }
  1785.         else
  1786.         {
  1787.             iPageCurrent += 1;
  1788.         }
  1789.     }
  1790.     
  1791.     if ( iPageCurrent > iPageMax ) iPageCurrent = iPageMax;
  1792.     if ( iPageCurrent < iPageMin ) iPageCurrent = iPageMin;
  1793.         
  1794.     objOTSForm.<%=FLD_PagingPageCurrent%>.value = iPageCurrent;
  1795.     objOTSForm.tSelectedItem.value = '' ;
  1796.     objOTSForm.tSelectedItemNumber.value = 0;
  1797.  
  1798.     var pKey = objOTSForm.fldPKeyParamName.value;
  1799.     var sURL = top.location;
  1800.     sURL = SA_MungeURL(sURL, pKey, "");
  1801.     sURL = OTS_MungeDeleteSearchSort(sURL);
  1802.     objOTSForm.action = sURL;
  1803.     
  1804.     objOTSForm.submit();
  1805.     
  1806.     return;
  1807. }
  1808.  
  1809. function OTS_SubmitSort(sortCol, sortSequence)
  1810. {
  1811.     var objOTSForm;
  1812.     
  1813.  
  1814.     objOTSForm = eval("document.TVData")
  1815.     if ( objOTSForm == null || objOTSForm.length <= 0 )
  1816.     {
  1817.         return;
  1818.     }
  1819.     objOTSForm.<%=FLD_SortingRequest%>.value = '1';
  1820.  
  1821.     //
  1822.     // If click is on current sort column, switch the sort sequence
  1823.     if ( objOTSForm.<%=FLD_SortingColumn%>.value == sortCol )
  1824.     {
  1825.         if ( objOTSForm.<%=FLD_SortingSequence%>.value == "A" )
  1826.         {
  1827.             objOTSForm.<%=FLD_SortingSequence%>.value = "D";
  1828.         }
  1829.         else
  1830.         {
  1831.             objOTSForm.<%=FLD_SortingSequence%>.value = "A";
  1832.         }
  1833.     }
  1834.     //
  1835.     // Otherwise, change sort columns and use same sort sequence
  1836.     else
  1837.     {
  1838.         objOTSForm.<%=FLD_SortingColumn%>.value = sortCol;
  1839.         objOTSForm.<%=FLD_SortingSequence%>.value = sortSequence.toUpperCase();
  1840.     }
  1841.  
  1842.  
  1843.     var pKey = objOTSForm.fldPKeyParamName.value;
  1844.     var sURL = top.location;
  1845.     sURL = SA_MungeURL(sURL, pKey, "");
  1846.     sURL = OTS_MungeDeleteSearchSort(sURL);
  1847.     objOTSForm.action = sURL;
  1848.     
  1849.     objOTSForm.submit();
  1850.     
  1851.     return;
  1852. }
  1853.  
  1854.  
  1855. function OTS_MungeDeleteSearchSort(sURL)
  1856. {
  1857.     sURL = SA_MungeURL(sURL, FLD_SearchItem, '');
  1858.     sURL = SA_MungeURL(sURL, FLD_SearchValue, '');
  1859.  
  1860.     sURL = SA_MungeURL(sURL, FLD_SortingEnabled, '');
  1861.     sURL = SA_MungeURL(sURL, FLD_SortingColumn, '');
  1862.     sURL = SA_MungeURL(sURL, FLD_SortingSequence, '');
  1863.     
  1864.     sURL = SA_MungeURL(sURL, FLD_PagingPageMin, '');
  1865.     sURL = SA_MungeURL(sURL, FLD_PagingPageMax, '');
  1866.     sURL = SA_MungeURL(sURL, FLD_PagingPageCurrent, '');
  1867.  
  1868.     return sURL;
  1869. }
  1870.  
  1871.  
  1872. function OTS_DisableToolbar()
  1873. {
  1874.     var objOTSForm;
  1875.     
  1876.     objOTSForm = eval("document.TVData")
  1877.     if ( objOTSForm == null || objOTSForm.length <= 0 )
  1878.     {
  1879.         return;
  1880.     }
  1881.     objOTSForm.<%=FLD_IsToolbarEnabled%>.value = '0';
  1882. }
  1883.  
  1884.  
  1885. function OTS_MungeSearchSort(sReturnURL)
  1886. {
  1887.     var oFormField;
  1888.         
  1889.     //
  1890.     // Add OTS Search item if necessary
  1891.     oFormField = eval("document.TVData.<%=FLD_SearchValue%>");
  1892.     if ( oFormField != null )
  1893.     {
  1894.         if ( document.TVData.<%=FLD_SearchValue%>.value.length > 0 )
  1895.         {
  1896.             sReturnURL = SA_MungeURL(sReturnURL, FLD_SearchItem, document.TVData.<%=FLD_SearchItem%>.value);
  1897.             sReturnURL = SA_MungeURL(sReturnURL, FLD_SearchValue, document.TVData.<%=FLD_SearchValue%>.value);
  1898.         }
  1899.     }
  1900.     //
  1901.     // Add OTS Sort item if necessary
  1902.     if ( document.TVData.<%=FLD_SortingEnabled%>.value.length > 0 )
  1903.     {
  1904.         if ( document.TVData.<%=FLD_SortingEnabled%>.value == '1' )
  1905.         {
  1906.             sReturnURL = SA_MungeURL(sReturnURL, FLD_SortingEnabled, document.TVData.<%=FLD_SortingEnabled%>.value);
  1907.             sReturnURL = SA_MungeURL(sReturnURL, FLD_SortingColumn, document.TVData.<%=FLD_SortingColumn%>.value);
  1908.             sReturnURL = SA_MungeURL(sReturnURL, FLD_SortingSequence, document.TVData.<%=FLD_SortingSequence%>.value);
  1909.         }
  1910.     }
  1911.     
  1912.  
  1913.     if ( document.TVData.<%=FLD_PagingPageCurrent%>.value.length > 0 )
  1914.     {
  1915.         sReturnURL = SA_MungeURL(sReturnURL, FLD_PagingPageMin, document.TVData.<%=FLD_PagingPageMin%>.value);
  1916.         sReturnURL = SA_MungeURL(sReturnURL, FLD_PagingPageMax, document.TVData.<%=FLD_PagingPageMax%>.value);
  1917.         sReturnURL = SA_MungeURL(sReturnURL, FLD_PagingPageCurrent, document.TVData.<%=FLD_PagingPageCurrent%>.value);
  1918.     }
  1919.  
  1920.     return sReturnURL;
  1921. }
  1922.  
  1923. function OTS_SetSearchChanged()
  1924. {
  1925.     var objOTSForm;
  1926.     
  1927.     objOTSForm = eval("document.TVData")
  1928.     if ( objOTSForm == null || objOTSForm.length <= 0 )
  1929.     {
  1930.         return;
  1931.     }
  1932.     objOTSForm.<%=FLD_SearchRequest%>.value = '1';
  1933.     return;
  1934. }
  1935.  
  1936. </script>
  1937. </head>
  1938. </html>
  1939. <%
  1940. End Function
  1941.  
  1942.  
  1943. Public Function SA_ServeDefaultClientScript()
  1944. %>
  1945. <script language="JavaScript" src="<%=m_VirtualRoot%>inc_global.js">
  1946. </script>
  1947. <script language="JavaScript">
  1948. function Init()
  1949. {
  1950. }
  1951. function ValidatePage()
  1952. {
  1953.     return true;
  1954. }
  1955. function SetData()
  1956. {
  1957. }
  1958. </script>
  1959. <%
  1960. End Function
  1961.  
  1962.  
  1963. %>
  1964.